package cn.initcap.concurrency.concurrency.singleton;

import cn.initcap.concurrency.annoations.NotThreadSafe;

/**
 * 懒汉模式{只有在单线程模式下没有问题}
 *
 * @author initcap
 * @date Created in 2018/6/14 PM12:26.
 */
@NotThreadSafe
public class SingletonOneCheck {

    /**
     * 单例对象
     */
    private static SingletonOneCheck instance = null;

    /**
     * 私有构造函数
     */
    private SingletonOneCheck() {

    }

    /**
     * 静态的工厂方法
     */
    public static SingletonOneCheck getInstance() {
        if (instance == null) {
            instance = new SingletonOneCheck();
        }
        return instance;
    }

}
